package com.alks.function.controller.procurement;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.procurement.PackagMaterialRequest;
import com.alks.function.data.request.procurement.PackagMaterialRequest2;
import com.alks.function.service.procurement.PackagMaterialDefinitionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@ApiRestController("/PackagMaterialDefinition")
@Slf4j
@Api(tags = {"采购部-包材类别定义"})
@RoleCheck(prgIds = {"150105"},methodName = "getPackagMaterialList")
public class PackagMaterialDefinitionController {

    @Autowired
    private PackagMaterialDefinitionService packagMaterialDefinitionService;

    @WebLogger
    @GetMapping("/getPackagMaterialList")
    @ApiOperation(value = "包材类别查询-回显",tags = "采购部-包材类别定义")
    public ResponseInfo getPackagMaterialList(){
        return packagMaterialDefinitionService.getPackagMaterialList();
    }

    @WebLogger
    @PostMapping("/deletePackagMaterial")
    @ApiOperation(value = "包材类别删除",tags = "采购部-包材类别定义")
    public ResponseInfo deletePackagMaterial(@RequestParam Integer seqNo){
        return packagMaterialDefinitionService.deletePackagMaterial(seqNo);
    }

    @WebLogger
    @PostMapping("/addPackagMaterial")
    @ApiOperation(value = "包材类别增加",tags = "采购部-包材类别定义")
    public ResponseInfo addPackagMaterial(@RequestBody PackagMaterialRequest request){
        return packagMaterialDefinitionService.addPackagMaterial(request);
    }

    @WebLogger
    @PostMapping("/updatePackagMaterial")
    @ApiOperation(value = "包材类别更新",tags = "采购部-包材类别定义")
    public ResponseInfo updatePackagMaterial(@RequestBody List<PackagMaterialRequest2> request){
        return packagMaterialDefinitionService.updatePackagMaterial(request);
    }
}
